package chapter20;

import java.util.Comparator;

public class PigObjectComparator implements Comparator<Pig> {

    public int compare(Pig o1, Pig o2) {
        Double weight1 = o1.getWeight();
        Double weight2 = o2.getWeight();
        if (weight1 < weight2)
            return -1;
        else if (weight1 == weight2)
            return 0;
        else
            return 1;

    }
}